import request from './request'

// 获取资源看板统计数据
export const getDashboardStats = () => {
  return request({
    url: '/dashboard/stats',
    method: 'GET'
  })
}

// 获取折线图数据
export const getLineChartData = () => {
  return request({
    url: '/dashboard/line-chart',
    method: 'GET'
  })
}

// 获取饼图数据
export const getPieChartData = () => {
  return request({
    url: '/dashboard/pie-chart',
    method: 'GET'
  })
}

// 获取资源列表数据
export const getDashboardResources = (params) => {
  return request({
    url: '/dashboard/resources',
    method: 'GET',
    params
  })
}

// 创建资源
export const createResource = (data) => {
  return request({
    url: '/dashboard/resources',
    method: 'POST',
    data
  })
}

// 更新资源
export const updateResource = (id, data) => {
  return request({
    url: `/dashboard/resources/${id}`,
    method: 'PUT',
    data
  })
}

// 删除资源
export const deleteResource = (id) => {
  return request({
    url: `/dashboard/resources/${id}`,
    method: 'DELETE'
  })
}
